load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("//exempi:gen_test_targets.bzl", "gen_test_targets")

package(default_visibility = ["//:__subpackages__"])

cc_library(
    name = "exempi",
    srcs = ["exempi.cpp"],
    hdrs = [
        "xmp.h",
        "xmp++.hpp",
        "xmpconsts.h",
        "xmperrors.h",
    ],
    includes = [""],
    deps = [
        "//XMPCore/source",
        "//XMPFiles/source",
        "//source",
        "//third-party/zuid/interfaces",
    ],
)

cc_binary(
    name = "bin",
    srcs = ["main.cpp"],
    local_defines = [
        # This needs to be defined to compile, but just leave it blank, people
        # will forget to update it.
        "VERSION=\\\"\\\"",
    ],
    deps = [":exempi"],
)

cc_library(
    name = "exempi_test_lib",
    testonly = True,
    srcs = ["tests/utils.cpp"],
    hdrs = ["tests/utils.h"],
    data = [
        "tests/fdo18635.jpg",
        "tests/fdo83313.jpg",
        "tests/test1.xmp",
        "//samples/testfiles",
    ],
    deps = [
        ":exempi",
        "@boost.format",
        "@boost.test//:hdrs",
    ],
)

filegroup(
    name = "test_dir",
    srcs = ["tests"],
)

gen_test_targets(
    name = "gen_exempi_test_targets",
    cc_srcs = glob(["tests/test*.cpp"]),
)
